using System;
using System.Drawing;
using System.Windows.Forms;

namespace GomokuGame
{
    /// <summary>
    /// AI颜色选择对话框
    /// </summary>
    public partial class AIColorDialog : Form
    {
        private RadioButton radioAIBlack;
        private RadioButton radioAIWhite;
        private Button btnOK;
        private Button btnCancel;
        private Label lblTitle;

        public PieceType SelectedAIColor { get; private set; }

        public AIColorDialog()
        {
            InitializeComponent();
            Load += AIColorDialog_Load;
        }

        private void InitializeComponent()
        {
            this.lblTitle = new Label();
            this.radioAIBlack = new RadioButton();
            this.radioAIWhite = new RadioButton();
            this.btnOK = new Button();
            this.btnCancel = new Button();
            this.SuspendLayout();

            // lblTitle
            this.lblTitle.AutoSize = true;
            this.lblTitle.Font = new Font("微软雅黑", 12F, FontStyle.Bold);
            this.lblTitle.Location = new Point(20, 20);
            this.lblTitle.Name = "lblTitle";
            this.lblTitle.Size = new Size(120, 21);
            this.lblTitle.Text = "选择AI颜色";

            // radioAIBlack
            this.radioAIBlack.AutoSize = true;
            this.radioAIBlack.Font = new Font("微软雅黑", 10F);
            this.radioAIBlack.Location = new Point(30, 60);
            this.radioAIBlack.Name = "radioAIBlack";
            this.radioAIBlack.Size = new Size(100, 20);
            this.radioAIBlack.Text = "AI执黑";
            this.radioAIBlack.UseVisualStyleBackColor = true;
            this.radioAIBlack.Checked = true;

            // radioAIWhite
            this.radioAIWhite.AutoSize = true;
            this.radioAIWhite.Font = new Font("微软雅黑", 10F);
            this.radioAIWhite.Location = new Point(30, 90);
            this.radioAIWhite.Name = "radioAIWhite";
            this.radioAIWhite.Size = new Size(100, 20);
            this.radioAIWhite.Text = "AI执白";
            this.radioAIWhite.UseVisualStyleBackColor = true;

            // btnOK
            this.btnOK.DialogResult = DialogResult.OK;
            this.btnOK.Font = new Font("微软雅黑", 9F);
            this.btnOK.Location = new Point(80, 140);
            this.btnOK.Name = "btnOK";
            this.btnOK.Size = new Size(75, 30);
            this.btnOK.Text = "确定";
            this.btnOK.UseVisualStyleBackColor = true;
            this.btnOK.Click += BtnOK_Click;

            // btnCancel
            this.btnCancel.DialogResult = DialogResult.Cancel;
            this.btnCancel.Font = new Font("微软雅黑", 9F);
            this.btnCancel.Location = new Point(170, 140);
            this.btnCancel.Name = "btnCancel";
            this.btnCancel.Size = new Size(75, 30);
            this.btnCancel.Text = "取消";
            this.btnCancel.UseVisualStyleBackColor = true;

            // AIColorDialog
            this.AcceptButton = this.btnOK;
            this.CancelButton = this.btnCancel;
            this.ClientSize = new Size(330, 190);
            this.Controls.AddRange(new Control[] {
                this.lblTitle,
                this.radioAIBlack,
                this.radioAIWhite,
                this.btnOK,
                this.btnCancel
            });
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "AIColorDialog";
            this.StartPosition = FormStartPosition.CenterParent;
            this.Text = "AI颜色选择";
            this.ResumeLayout(false);
            this.PerformLayout();
        }

        private void AIColorDialog_Load(object sender, EventArgs e)
        {
            // 设置默认选择
            SelectedAIColor = PieceType.White;
        }

        private void BtnOK_Click(object sender, EventArgs e)
        {
            if (radioAIBlack.Checked)
            {
                SelectedAIColor = PieceType.Black;
            }
            else if (radioAIWhite.Checked)
            {
                SelectedAIColor = PieceType.White;
            }
        }
    }
} 